package com.loveprogrammer.eternity.model.affix.levelthree;

import com.loveprogrammer.eternity.enums.QualityEnum;
import com.loveprogrammer.eternity.factory.EffectFactory;
import com.loveprogrammer.eternity.model.affix.Affix;
import com.loveprogrammer.eternity.model.effect.AbstractEffect;
import com.loveprogrammer.eternity.model.effect.Effect;
import com.loveprogrammer.eternity.model.product.Equipment;

import java.util.List;
import java.util.Random;

/**
 * @version 1.0.0
 * @description:
 * @author: eric
 * @date: 2022-08-24 18:24
 **/
public class SylvanasAffix implements Affix {

    private final int base = 6;

    @Override
    public Equipment addEffect(Equipment equipment) {
        // 加技 体 速
        String name = equipment.getName();
        equipment.setName(affix() + name);
        // 计算增加的值
        QualityEnum quality = equipment.getQuality();
        int level = equipment.getLevel();
        int addMax = (int) (compute(level,base) * quality.getRatio() * ratio_level_three);
        int addMin = addMax/2;

        equipment.setTechnique(equipment.getTechnique() + addMin + new Random().nextInt(addMax - addMin));
        equipment.setConstitution(equipment.getConstitution() + addMin + new Random().nextInt(addMax - addMin)/2);
        equipment.setSpeed(equipment.getArmature() + addMin/2 + (new Random().nextInt(addMax - addMin))/2);
        // 第四级别的有特殊效果 吸血
//        equipment.setName(affix() + name + "[妖巫]");
//        List<AbstractEffect> effectList = equipment.getEffects();
//        AbstractEffect effect = EffectFactory.getEffectById(1);
//        effectList.add(effect);
//        equipment.setEffects(effectList);
        return equipment;
    }

    @Override
    public int group() {
        return 3;
    }

    @Override
    public String affix() {
        return "希尔瓦纳斯之";
    }
}
